<template>
<a-card :bordered="false">
    <div class="table-operator">
        <a-button shape="round" size="small" type="primary" icon="plus" @click="handleEdit({},'orgForm','新增')">新增</a-button>
    </div>
    <LTable
        ref="orgList"
        size="middle"
        rowKey="keyId"
        :columns="columns"
        axiosUrl="/SysOrgController/queryOrgTableTree"
        :showPagination="false"
        :showQueryForm="false"
      >
    
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record,'orgForm',record.orgName)">编辑</a>
          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="将会删除此组织以及所有子组织，确定删除吗?" @confirm="() => handleDelete({orgNo:record.orgNo},delUrl,'orgList')">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
        
    </LTable>
    <orgForm ref="orgForm" @close="refresh('orgList')" @ok="refresh('orgList')"></orgForm> 
</a-card>
    
</template>

<script>
import LTable from '@/components/lt/LTable'
import orgForm from './orgForm'
import {SysMixin} from '@/mixins/SysMixin'

export default {
    name:'orgList',
    components: {
        LTable,
        orgForm
    },
    mixins:[SysMixin],
    data(){
        return{
            delUrl:'/SysOrgController/del',
            columns:[
                {
                    title: '组织编号',
                    dataIndex: 'orgNo'
                },
                {
                    title: '组织名称',
                    dataIndex: 'orgName', 
                },
                
                {
                    title: '操作',
                    dataIndex: 'action',
                    width: '150px',
                    scopedSlots: { customRender: 'action' }
                }
            ]

        }
    },
    methods:{
        
    }
    
}
</script>